import {fetch,upload} from 'utils/fetch';

/***
 * 保存认证信息
 * @param data
 * @returns {*}
 */
export function saveAgreedData(data) {
    return fetch({
        url: '/certification/save',
        method: 'post',
        data: data
    });
}

/***
 * 保存通览认证信息
 * @param data
 * @returns {*}
 */
export function saveTlAgreedData(data) {
  return fetch({
    url: '/register/improveUserInfoFromTL',
    method: 'post',
    data: data
  });
}
/***
 * 查询客户经理信息
 * @param data
 * @returns {*}
 */
export function searchClientMangerData(data) {
  return fetch({
    url: '/certification/managerQuery',
    method: 'post',
    data: data
  });
}

/***
 * 查询企业信息
 * @param data
 * @returns {*}
 */
export function searchCompanyInfoData(data) {
  return fetch({
    url: '/certification/query',
    method: 'post',
    data: data
  });
}

/***
 * 保存实名认证结果
 * @param data
 * @returns {*}
 */
export function saveAuthorizedResult(data) {
  return fetch({
    url: '/certification/saveCompanyAuthorizedResult',
    method: 'post',
    data: data
  });
}

/***
 * 查询贷款资金投向
 * @param data
 * @returns {*}
 */
export function queryLoanPurposeList(data) {
  return fetch({
    url: '/certification/queryCompanyProductHzbankLoanPurposeDtoList',
    method: 'post'
  });
}
/***
 * 生成userToken
 * @param data
 * @returns {*}
 */
export function createUserToken(data) {
  return fetch({
    url: '/certification/createUserToken',
    method: 'post'
  });
}
/***
 * 生成companyToken
 * @param data
 * @returns {*}
 */
export function createCompanyToken(data) {
  return fetch({
    url: '/certification/createCompanyToken',
    method: 'post'
  });
}
/***
 * 根据企业ID签署PDF授权电子签章
 * @param data
 * @returns {*}
 */
export function signatureCompanyAccreditedPdf() {
  return fetch({
    url: '/authorization/signatureCompanyAccreditedPdf',
    method: 'post'
  });
}

/***
 *
 * @param data
 * @returns {*}
 */
export function queryCreditApplyStep(id) {
	return fetch({
		url: '/credit/queryCreditApplyStepWMR?id='+id,
		method: 'post'
	});
}
//POST 保存/修改用户KYC
export function modifyUserKyc(data) {
	return fetch({
		url: '/certification/modifyUserKyc',
		method: 'post',
		data
	});
}

/***
 * POST 营业执照上传
 * @returns {*}
 */
export function licenseUpload(data) {
	return upload({
		url: '/certification/comQualification',
		method: 'post',
		headers:{'Content-Type':'multipart/form-data'},
		data
	});
}
/***
 * POST 身份证上传(正面)
 * @returns {*}
 */
export function idCardUpload(data) {
	return upload({
		url: '/certification/idCardFrontUpload',
		method: 'post',
		headers:{'Content-Type':'multipart/form-data'},
		data
	});
}
/***
 * POST 身份证上传(反面)
 * @returns {*}
 */
export function idCardUploadBack(data) {
	return upload({
		url: '/certification/idCardBackUpload',
		method: 'post',
		headers:{'Content-Type':'multipart/form-data'},
		data
	});
}

//POST 授信确认POST
export function confirmApply(fundCode,uscCode,productCode) {
	return fetch({
		url: '/credit/confirmApplyInfo?fundCode='+fundCode+'&uscCode='+uscCode+'&productCode='+productCode,
		method: 'post'
	});
}
//POST 查询是否授信
export function IsCreditApply() {
	return fetch({
		url: '/credit/isCreditApply',
		method: 'post'
	});
}
//POST 查询资方授信状态
export function creditApplyStatus(data) {
	return fetch({
		url: '/credit/queryCreditApplyStep',
		method: 'post',
		data
	});
}
//POST 查询是否有产品在授信中
/*export function isCreditApplyOrnot(uscCode) {
	return fetch({
		url: '/credit/queryCreditApply?uscCode='+uscCode,
		method: 'post'
	});
}*/

//POST 授信申请
export function creditApply(data) {
	return fetch({
		url: '/credit/confirmApply',
		method: 'post',
		data
	});
}


//POST 是否需要进行签章
export function isESign(uscCode) {
	return fetch({
		url: '/esignInfo/isESign?uscCode='+uscCode,
		method: 'post'
	});
}

//POST 签章
export function esign(data) {
	return fetch({
		url: '/esignInfo/esign',
		method: 'post',
		data
	});
}

// POST 外贸融确认授权
export function wmrConfirmAuthorize(uscCode) {
	return fetch({
		url: '/credit/wmrConfirmAuthorize?uscCode='+uscCode,
		method: 'post'
	});
}
// POST 外贸融确认授信
export function wmrConfirmApply(uscCode) {
	return fetch({
		url: '/credit/wmrConfirmApply?uscCode='+uscCode,
		method: 'post'
	});
}
export function queryFundNameAndQuota(uscCode,productCode,fundCode) {
	return fetch({
		url: '/credit/queryFundNameAndQuota?uscCode='+uscCode+'&productCode='+productCode+'&fundCode='+fundCode,
		method: 'post'
	});
}

// POST 查询开户信息
export function queryOpenAccountMessage(data) {
	return fetch({
		url: '/credit/queryOpenAccountMessage',
		method: 'post',
		data
	});
}

// 确认开户结果(外贸融)
export function confirmOpenResult() {
	return fetch({
		url: '/credit/confirmOpenResult',
		method: 'post'
	});
}

// 预授信额度
export function wmrQueryAdvanceCreditQuota(uscCode,productCode) {
	return fetch({
		url: '/credit/wmrQueryAdvanceCreditQuota?uscCode='+uscCode+'&productCode='+productCode,
		method: 'post'
	});
}
